# Maintainer: Levente Polyak <anthraxx@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: cs-cam - me.at.camdaniel.com

_pkgname=pybluez
pkgname=python-pybluez
pkgver=0.23.r58.g4d46ce1
# somewhere past 0.23 as upstream hasn't released in ages ;_;
_commit=4d46ce14d9e888e3b0c65d5d3ba2a703f8e5e861
pkgrel=2
pkgdesc="Python wrapper for the BlueZ Bluetooth stack"
arch=('loong64' 'x86_64')
url="https://pybluez.github.io/"
license=('GPL2')
depends=(
  'bluez-libs'
  'glibc'
  'python'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
# optdepends=('python-gattlib: for Bluetooth Low Energy device support')  # TODO: needs to be packaged
source=(
  git+https://github.com/pybluez/pybluez#commit=$_commit
)
sha256sums=('SKIP')
b2sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd $_pkgname
  python -m build --wheel --no-isolation
}

package_python-pybluez() {
  cd $_pkgname
  python -m installer --destdir="$pkgdir" dist/*.whl
}
